build(deps-dev): replace standard with neostandard#421
Merged
Conversation
| resolve(""); | ||
| }); | ||
| }); | ||
| const child = exec(`${instance} "${process.cwd()}/test/typescript-jest/integration/instance.ts"`) |
Check warning
Code scanning / CodeQL
Shell command built from environment values
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix the problem, we should avoid constructing the shell command using template literals and instead use the execFile method from the child_process module. This method allows us to pass the command and its arguments separately, which prevents the shell from interpreting special characters in the arguments.
We need to:
- Replace the
execmethod withexecFile. - Pass the command and its arguments as separate parameters to
execFile.
Suggested changeset
1
test/typescript-jest/integration/integration.test.ts
| @@ -1,2 +1,2 @@ | ||
| import { exec } from 'child_process' | ||
| import { execFile } from 'child_process' | ||
|
|
||
| @@ -7,3 +7,3 @@ | ||
| await new Promise(function (resolve, reject) { | ||
| const child = exec(`${instance} "${process.cwd()}/test/typescript-jest/integration/instance.ts"`) | ||
| const child = execFile(instance, [`${process.cwd()}/test/typescript-jest/integration/instance.ts`]) | ||
| let stderr = '' |
Copilot is powered by AI and may make mistakes. Always verify output.
jsumners
approved these changes
Nov 29, 2024
Member
Author
|
Test failure unrelated, see #420 which is also failing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
npm run testandnpm run benchmarkand the Code of conduct